// 引入接口地址
import { bannerList } from "@/request/api"

// 轮播图仓库模块
const state = {
    bannerList: [],
}

const mutations = {
    REQ_BANNER(state, payload) {
        return state.bannerList = payload
    }
}

const actions = {
    getBannerList_Action({ commit }) {
        // 调用轮播图列表接口
        bannerList().then(res => {
            console.log(res);
            if (res.code == 200) {
                commit("REQ_BANNER", res.list)
            }
        })
    }
}

const getters = {
    getBannerList(state) {
        return state.bannerList
    }
}

// 导出仓库
export default {
    state,
    mutations,
    actions,
    getters,
    namespaced: true
}